#include <stdio.h>
//此代码有毒。很毒。
int main(){
    FILE *fp=fopen("/Users/zhongjiwang/Desktop/mi.txt","w");
    
    if(!fp){
        printf("文件打开失败\n");
    }else {
        printf("文件打开成功\n");
        int a=123456789;
        //double d=6.5;
        //char s[]="nicesadasdasdasdasdad\n";
        int returenValue=fprintf(fp,"%d",a);
        printf("returenValue=%d\n",returenValue);
    }
    
    fclose(fp);
    //读取
    FILE * fp2 =fopen("/Users/zhongjiwang/Desktop/mi.txt","r");
    if(!fp2){printf("打开失败");}
    else {
        printf("打开成功");
        //定义一个字符数组用来保存读取的字符串
//        char gs[][20]={""};
//        for (int i=0; i<6; i++) {
//            fscanf(fp2, "%s",gs[i]);
//        }
//        for (int i=0; i<6; i++) {
//            printf("%s",gs[i]);
//        }
//    i
        int c=0;
        //移动当前位置指针
        fseek(fp2,3L,0);
        //将位置指针移动到文件首
      //  rewind(fp2);
        fscanf(fp2, "%d",&c);
        printf("c=%d\n",c);
    
    }
}